Skip to content

test: migrate math/base/special/gamma-lanczos-sum-expg-scaled to ULP-based assertions - #14336

Merged
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-1as5hb
Aug 16, 2026
Merged

test: migrate math/base/special/gamma-lanczos-sum-expg-scaled to ULP-based assertions#14336
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-1as5hb

Conversation

@kgryte

@kgryte kgryte commented Aug 16, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • migrates the tests for math/base/special/gamma-lanczos-sum-expg-scaled from relative tolerance testing to ULP difference testing, per [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • replaces the delta/tol computation and the y === expected special case in test/test.js and test/test.native.js with a single t.strictEqual( isAlmostSameValue( y, expected, 12 ), true, 'returns expected value' ); assertion.
  • removes the now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires and adds @stdlib/assert/is-almost-same-value.

ULP bound: 12 for both test/test.js and test/test.native.js.

This is the measured minimum. Over the full linspace( 1.0, 100.0, 500 ) fixture set, the worst-case ULP difference is 12, occurring at x = 6.158316633266534, and it is the only point above 11 (the next largest difference in the set is 10). Starting from a high bound and tightening, 12 passes all 503 assertions and 11 fails exactly one, for both the JavaScript and the native (C) implementation. Each suite was run twice at the final bound with identical results, so the bound is not sensitive to FMA/arch variation on this machine.

The previous tolerance was 10.0 * EPS * abs( expected ), i.e. roughly 40 ULP, so the new bound is strictly tighter than what it replaces.

This mirrors the migration already merged for the sibling package math/base/special/gamma-lanczos-sum (#14031), which settled on the same bound of 12.

Only the two test files are changed; no source, documentation, or package.json changes are included.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Verification performed locally:

  • make test TESTS_FILTER=".*/math/base/special/gamma-lanczos-sum-expg-scaled/.*"test/test.js 503 passing, 0 failing; test/test.native.js 503 passing, 0 failing. Run twice with identical results.
  • test/test.native.js was exercised against a locally built addon (make install-node-addons NODE_ADDONS_PATTERN="gamma-lanczos-sum-expg-scaled"), so the native assertions ran rather than being skipped.
  • Tightness check: temporarily lowering the bound to 11 produced 502 passing / 1 failing, confirming 12 is the minimum.
  • make lint-javascript-tests TESTS_FILTER=".*/math/base/special/gamma-lanczos-sum-expg-scaled/.*" — clean.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was authored by Claude Code running as an unattended scheduled task. The test migration and the ULP bound search (start high, tighten to the minimum that still passes, then re-run to confirm determinism) were performed by the agent, following the idiom established in already-migrated packages in math/base/special.


@stdlib-js/reviewers


Generated by Claude Code

…P-based assertions

Ref: #11352

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RxMQy5RCWnbGv3PwexRff1
@stdlib-bot stdlib-bot added Math Issue or pull request specific to math functionality. Good First PR A pull request resolving a Good First Issue. labels Aug 16, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/gamma-lanczos-sum-expg-scaled $\\color{red}255/258$
$\\color{green}+98.84\\%$
$\\color{red}8/10$
$\\color{green}+80.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{red}255/258$
$\\color{green}+98.84\\%$

The above coverage report was generated for the changes in this PR.

@kgryte kgryte added the Tests Pull requests specifically adding tests. label Aug 16, 2026
@kgryte
kgryte marked this pull request as ready for review August 16, 2026 22:32
@kgryte
kgryte requested a review from a team August 16, 2026 22:32
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 16, 2026
@kgryte
kgryte merged commit 1243049 into develop Aug 16, 2026
82 checks passed
@kgryte
kgryte deleted the claude/great-brahmagupta-1as5hb branch August 16, 2026 22:33
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Good First PR A pull request resolving a Good First Issue. Math Issue or pull request specific to math functionality. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants